from pydantic import BaseModel, Field
from typing import List

#地图信息配置
class MapInfoSettings(BaseModel):
    s_date: str = Field(..., title='开始时间',description='如：2022-05-04 20:06:15')
    e_date: str = Field(..., title='结束时间',description='如：2022-05-04 20:06:15')

#车型统计配置
class CarTypeSettings(BaseModel):
    types: List[str] = Field(..., title='车型选择', description='列表中的字符串来自于 `/car_type` 接口的返回数据')

#车辆耗电异常展示配置
class CarElectronSettings(BaseModel):
    TopN: int = Field(..., title='可展示条数')
    s_date: str = Field(..., title='开始时间',description='如：2022-05-04 20:06:15')
    e_date: str = Field(..., title='结束时间',description='如：2022-05-04 20:06:15')

#车辆电流异常展示配置
class VehicleCurrentSettings(BaseModel):
    TopN: int = Field(..., title='可展示条数')
    threshold: int = Field(..., title='电流异常阈值配置')

#加速踏板异常展示配置
class AcceleratorPedalSettings(BaseModel):
    TopN: int = Field(..., title='可展示条数')
    threshold: int = Field(..., title='加速踏板异常阈值配置')

#制动踏板异常展示配置
class BreakPedalSettings(BaseModel):
    TopN: int = Field(..., title='可展示条数')
    threshold: int = Field(..., title='制动踏板异常阈值配置')

#SOC异常展示配置
class SocAbnormalitySettings(BaseModel):
    TopN: int = Field(..., title='可展示条数')
    threshold: int = Field(..., title='SOC异常阈值配置')

#异常状态统计配置
class StatusStatisticsSettings(BaseModel):
    s_date: str = Field(..., title='开始时间',description='如：2022-05-04 20:06:15')
    e_date: str = Field(..., title='结束时间',description='如：2022-05-04 20:06:15')
    status: List[str] = Field(..., title='异常状态选择', description='列表中的字符串来自于 `/exce_status` 接口的返回数据')


#攻击态势展示配置
class AttackDisplaySettings(BaseModel):
    time_span: str = Field(..., regex='(一周)|(一月)')
    attack_type: List[str] = Field(..., title='攻击类型选择', description='列表中的字符串来自于 `/attack_show` 接口的返回数据')


#车辆攻击统计配置
class AttackStatisticsSettings(BaseModel):
    s_date: str = Field(..., title='开始时间',description='如：2022-05-04 20:06:15')
    e_date: str = Field(..., title='结束时间',description='如：2022-05-04 20:06:15')
    TopN: int = Field(..., title='可展示条数')
    attack_type: List[str] = Field(..., title='攻击类型选择', description='列表中的字符串来自于 `/car_attack` 接口的返回数据')


# 安全日志的配置
class SecurityLogSettings(BaseModel):
    when: str = Field(..., title='监测安全日志和告警日志的时间', regex=r'(今天)|(\d{8})')